/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.feignimpl.payment;

import com.enation.app.javashop.client.payment.PaymentClient;
import com.enation.app.javashop.core.client.fallback.payment.PaymentClientFallbackFactory;
import com.enation.app.javashop.core.handler.FeignConfiguration;
import com.enation.app.javashop.model.payment.dos.PaymentMethodDO;
import com.enation.app.javashop.model.payment.dto.PayParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 支付中心client
 *
 * @author fk
 * @version v7.0
 * @date 20/3/9 下午3:51
 * @since v7.2.1
 */
@FeignClient(name = "payment-service", fallbackFactory = PaymentClientFallbackFactory.class,configuration = {FeignConfiguration.class})
public interface PaymentClientFeignImpl extends PaymentClient {

    /**
     * 对一个子订单发起支付
     * @param param
     * @return
     */
    @Override
    @RequestMapping(value = "/client/payment/pay",method = RequestMethod.POST)
    Map pay(@RequestBody PayParam param);

    /**
     * 查询一个账单的支付状态
     * @param subSn
     * @param serviceType
     * @return
     */
    @Override
    @RequestMapping(value = "/client/payment/bill",method = RequestMethod.GET)
    String queryBill(@RequestParam("sub_sn") String subSn, @RequestParam("service_type")String serviceType);


    /**
     * 根据支付插件id获取支付方式详细
     * @param pluginId
     * @return
     */
    @Override
    @RequestMapping(value = "/client/payment/{plugin_id}",method = RequestMethod.GET)
    PaymentMethodDO getByPluginId(@PathVariable("plugin_id") String pluginId);

}
